/**
 * @Author ZhangCuirong
 * @Date 2025/9/3 14:24
 * @description:
 */
public class Solution509 {
    public int fib(int n) {
        if (n <= 1) {
            return n;
        }
        int first = 0;
        int second = 1;
        for (int i = 2; i <= n; i++) {
            int temp = second;
            second = first + second;
            first = temp;
        }
        return second;
    }

    public static void main(String[] args) {
        Solution509 solution = new Solution509();
        System.out.println(solution.fib(4));
    }
}
